package com.anniljing.kotlionlearn.Basic.classes

fun main() {
    var dataClassPerson = DataClassPerson("Hello", "中国")
    dataClassPerson.age = 28
    //toString方法只打印出主构造函数里面的属性值
    //DataClassPerson(name=Hello, country=中国)
    println(dataClassPerson.toString())
    //data class copy
    val copyDataClass = dataClassPerson.copy()
    println("CopyDataClass:${copyDataClass.javaClass}")
    println("DataClassPerson:${dataClassPerson.javaClass}")
    //data class copy hashcode
    println("CopyDataClass hashCode:${copyDataClass.hashCode()}")
    println("DataClass hashCode:${dataClassPerson.hashCode()}")
    //data class copy equals
    println("copyDataClass is Equals dataClass :${dataClassPerson == copyDataClass}")
    println(copyDataClass.toString())
    println(copyDataClass.age)
    //Destructuring declarations(解构声明)
    val (personName, personAge) = dataClassPerson
    println("PersonName=${personName}\nPersonAge=${personAge}")
}
